<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="index.css">
    <script src="../vue.js"></script>
</head>
<body>
    <div id="app">
        <table>
            <tr>
                <th>ID</th>
                <th>名称</th>
                <th>价格</th>
                <th>数量</th>
                <th>操作</th>
                <th>库存</th>
            </tr>
            <tr v-for="item in goods">
                <td>{{item.id}}</td>
                <td>{{item.name}}</td>
                <td>{{item.price}}</td>
                <td>
                    <button @click='item.num--':disabled="item.num==0">-</button>
                    {{item.num}}
                    <button @click='item.num++':disabled="item.num==item.kucun">+</button>
                </td>
                <td><button @click="item.num=0">清空</button></td>
                <td>({{item.kucun}})</td>
            </tr>
        </table>
        <h3>总价:{{sum}}</h3>
    </div>

    <script src="index.js"></script>
</body>
</html>